Using gitignore with Xcode for iPhone development

Using git is a pleasure, but using it for iPhone development benefits from utilizing the gitignore function.

We want to commit code to our repository, but we want that commit to skip the build files generated locally for the simulator and device:

#Ignore the Mac OS X .DS_Store files
.DS_Store

#Ignore user-specific settings
*.mode1v3
*.mode2v3
*.pbxuser
*.perspectivev3

#Ignore textmate build errors
*.tm_build_errors

#Ignore temp nibs and swap files
*.swp
*~.nib

#Ignore the build, since we don't want archived builds
build

Put this content in a file called .gitignore and place it in the root of $GIT_DIR. If you wish to create a local .gitignore that applies to all your git repositories, place it in ~/ and edit ~/.gitconfig to reference the file:1

[core]
excludesfile = ~/.gitignore

Resources:
http://www.kernel.org/pub/software/scm/git/docs/gitignore.html
http://stackoverflow.com/questions/49478/git-ignore-file-for-xcode-projects

1Thanks to Mike C for some clarification on committing the .gitignore file

Habari

This site is running Habari, a state-of-the-art publishing platform! Habari is a community-driven project created and supported by people from all over the world. Please visit http://habariproject.org/ to find out more!